import React from "react";

const CommentList = ({comments})=>{
    const activeComments = () =>{
        if (activeTYpe === 'Good'){
           return comments.filter((item) => item.rating === 4||item.rating === 5)
        }
        if (activeTYpe === 'Neutral'){
            return comments.filter((item) => item.rating === 2||item.rating === 3)
        }
        if (activeTYpe === 'Bad'){
            return comments.filter((item) => item.rating === 0||item.rating === 1)
        }
    }

    return (
        <ul>
            {comments.map((item)=>(
                <li key={item.id}>
                    <span>{item.user}</span>
                    <span>Rating: {item.rating}</span>
                    <p>{item.comments}</p>
                </li>
            ))
            }
        </ul>
    )
}
export default CommentList;
